<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'db/db_config.class.php');
require_once(TANGRA_MAIN_DIR.'db/db_config_loader_file.class.php');
require_once(TANGRA_MAIN_DIR.'web_site/web_context.class.php');

require_once($PATHS->get_hidden().'inc/modules/visitors_cookies/visitors_cookies_config_loader_file.class.php');
require_once($PATHS->get_hidden().'inc/modules/visitors_cookies/visitor_cookie_handler.class.php');
require_once($PATHS->get_hidden().'inc/_sys/site_dbc_pnt.class.php');


$visitors_cookies_loader_file = new Visitors_Cookies_Loader_File($PATHS->get_hidden().'conf/'.TANGRA_MACHINE_SPECIFIC_CONF_FILENAME);


$vc_config['cookie_name'] = $visitors_cookies_loader_file->get_cookie_name();
$vc_config['expire'] = $visitors_cookies_loader_file->get_expire();
$vc_config['path'] = $visitors_cookies_loader_file->get_path();
$vc_config['domain'] = $visitors_cookies_loader_file->get_domain();
$vc_config['secure'] = $visitors_cookies_loader_file->get_is_secure();

global $_SITE_DBC_PNT;

if (!($_SITE_DBC_PNT instanceof DB_Connection)) {
	$db_config_loader = new DB_Config_Loader_File($PATHS->get_hidden().'conf/db.conf');
	$db_config = new DB_Config();
	$db_config_loader->load_db_config($db_config);

	$_SITE_DBC_PNT = new Site_DBC_PNT($db_config);
}

$context = new Web_Context();

global $_VISITOR_COOKIE;
Visitor_Cookie_Handler::handle_cookie($_VISITOR_COOKIE, $_SITE_DBC_PNT, $context, $vc_config);

